package zhuyun.code.datamanager.utils

import android.content.Context

/**
 * @author: Administrator
 * @date: 2021/11/2
 */
class UIUitls {
    companion object{
        fun px2dip(context: Context, pxValue: Float): Int {
            val scale: Float = context.resources.displayMetrics.density
            return (pxValue / scale + 0.5f).toInt()
        }

        fun dip2px(context: Context, dpValue: Float): Int {
            val scale = context.resources.displayMetrics.density
            return (dpValue * scale + 0.5f).toInt()
        }
    }

}